#coding=utf-8
import Animal,myutil
import time,random
class Cat(Animal.mm):
    def MIAOMIAO(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")" +"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级喵喵拳")
        myutil._write("zhanbao.txt", 'a', "》》》【"+self.name + "("+str(self.HP)+")" +"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级喵喵拳\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)
class Rabbit(Animal.mm):

    def TUTU(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级兔兔腿")
        myutil._write("zhanbao.txt", 'a',"》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级兔兔腿\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)

 #-------------------- 天上 ------------
class LG(Animal.mm):
    def LIAOGE(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级鹩哥啄")
        myutil._write("zhanbao.txt", 'a',"》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级鹩哥啄\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)
class MQ(Animal.mm):
    def GSKH(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>杠上开花")
        myutil._write("zhanbao.txt", 'a',"》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>杠上开花\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)

# -------------------- 海 ------------
class Haitun(Animal.mm):
    def YINYIN(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级海豚音")
        myutil._write("zhanbao.txt", 'a',"》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级海豚音\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)

class MY(Animal.mm):
    def DSN(self, obj , _hp ):
        print("》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级电屎你")
        myutil._write("zhanbao.txt", 'a',"》》》【"+self.name + "("+str(self.HP)+")"+"】" + "向【"+obj.name + "("+str(obj.HP)+")"+ "】出大招>>>超级电屎你\n", "utf-8")
        obj.HP -= _hp
        obj.run(_hp)
class NVWANG():
    def __init__(self,name="肖婷婷"):
        self.name = name
    def 河东狮吼(self):
        print( ">>> 超级大招：韩轰，王力轰，玛丽玛丽轰\n\n")
        myutil._write("zhanbao.txt", 'a', self.name + " 超级大招》》》》 还轰，往里轰，玛丽玛丽轰\n\n", "utf-8")
        print(">>>``海军、陆军、空军`` 大家快跑啊，莎比士亚来了~~\n\n")
        myutil._write("zhanbao.txt", 'a', "``海军、陆军、空军`` 大家快跑啊，莎比士亚来了~~\n", "utf-8")
#------- 地面上出现了一只小喵喵
c = Cat("小喵喵" ,HP=100)
# c.run("闪烁")
# c.miaomiao()
#-------地面上出现了一只小兔几
# r = Rabbit("小兔兔",HP=100)
#------小喵喵 和 小兔几 打架
# 小喵喵打小兔子 一下
# c.attack("喵喵拳", r, 10)
#小兔子中招
# print(r.HP)
# #小兔子出招
# r.attack("兔兔腿X 10 ", c,100)
# r.attack("兔兔腿X 10 ", c,100)
#-----这个时候来了一只鹩哥
lg = LG("鹩哥", HP=50)
mq = MQ("麻雀", HP=50)
haitun = Haitun("海豚", HP=80)
my = MY("鳗鱼", HP=80)
print("****************************")
print("****** 欢迎来到斗罗大陆 ******")
print("****** [1]海 ***************")
print("****** [2]陆 ***************")
print("****** [3]空 ***************")
print("****** [any]超级英雄 ***************")
print("****************************")
zhandui = []
A = []
B = []
#判断省略
while("挺好玩的"):
    s = input("请选择\n>>>")
    if s == "1":
        c = Cat("小喵喵", HP=100)
        r = Rabbit("小兔兔",HP=100)
        zhandui.append({"小喵喵": c})
        zhandui.append({"小兔几": r})
    elif s == "2":
        lg = LG("鹩哥", HP=50)
        mq = MQ("麻雀", HP=50)
        zhandui.append({"小鹩哥": lg})
        zhandui.append({"小麻雀": mq})
    elif s == "3":
        haitun = Haitun("海豚", HP=80)
        my = MY("鳗鱼", HP=80)
        zhandui.append({"小海豚": haitun})
        zhandui.append({"小鳗鱼": my})
    if(len(zhandui)>=6):
        # myutil.randomZD(zhandui)
        print("组队结束")
        # 可模拟随机 严格按顺序输入...
        # A.append(zhandui[0]['c'])
        # B.append(zhandui[1]['r'])
        # A.append(zhandui[2]['lg'])
        # B.append(zhandui[3]['mq'])
        # A.append(zhandui[4]['haitun'])
        # B.append(zhandui[5]['my'])
        A.append(zhandui[0])
        B.append(zhandui[1])
        A.append(zhandui[2])
        B.append(zhandui[3])
        A.append(zhandui[4])
        B.append(zhandui[5])
        print("A战队：")
        print(A)
        print("B战队：")
        print(B)
        break
print("》》》敌军还有5秒到达战场...")
time.sleep(1)
print("》》》小喵喵队先出招")
c1 = A[0]['小喵喵']
r1 = B[0]['小兔几']
lg = A[1]['小鹩哥']
mq = B[1]['小麻雀']
ht = A[2]['小海豚']
my = B[2]['小鳗鱼']
###c1 -> r1
c1.attack("喵喵拳", r1, random.randint(1,20))
time.sleep(1)
#还击 r1 -> c1
r1.attack("兔兔腿", c1,  random.randint(1,30))
### lg -> mq
time.sleep(1)
lg.attack("哈哈哈", mq, random.randint(1,40))
## mq -> lg
time.sleep(1)
mq.attack("海底捞月", lg, random.randint(1,50))
## ht -> my
time.sleep(1)
ht.attack("音音音", my, random.randint(1,50))
## my -> ht
time.sleep(1)
my.attack("电光火石", ht, random.randint(1,50))
#大招 c1 <--> r1
time.sleep(2)
c1.MIAOMIAO(r1, random.randint(50,90))
if myutil.hp(r1.HP):
    time.sleep(2)
    r1.TUTU(c1, random.randint(70, 90))
# lg <--> mq

time.sleep(2)
lg.LIAOGE(mq, random.randint(70,90))
if myutil.hp(mq.HP):
    time.sleep(2)
    mq.GSKH(lg, random.randint(70, 90))
# my <--> ht
time.sleep(2)
ht.YINYIN(my, random.randint(70,90))
if myutil.hp(my.HP):
    time.sleep(2)
    my.DSN(ht, random.randint(70, 90))
vv = "---------------------------\n第一轮战罢\n\t动物们正玩得开心...\t此时\n"
myutil._write("zhanbao.txt", 'a', vv, "utf-8")
print(vv) #
nvwang = NVWANG()
vv = " 女王" + nvwang.name+"驾到\n只见她\n"
print(vv)  #韩红，王力宏...
myutil._write("zhanbao.txt", 'a', vv, "utf-8")
time.sleep(5)
nvwang.河东狮吼()

time.sleep(5)
vv = "**********************************\n*****************彩蛋**************\n**********************************\n"
myutil._write("zhanbao.txt", 'a', vv, "utf-8")
print(vv)
time.sleep(5)
rose="                 { @}\n"
rose+="		       { @} ?{  @}\n"
rose+="		     { @} ?{ @} ?{ @}\n"
rose+="         { @}?{ @} ?{ @} ?{ @}\n"
rose+="          \ { @} ?{ @} ?{ @} /\n"
rose+="             \ \ \ 我  / / /\n"
rose+="              \\\\ \ 爱  /  //\n"
rose+="                \\\\  P  //\n"
rose+="                 \\\\ Y  //\n"
rose+="                  >= <\n"
rose+="                 /    \\\n"
print(rose)
myutil._write("zhanbao.txt", 'a', rose, "utf-8")
thanks = "\n\t"*3 + "Thank u for watching"
time.sleep(2)
print(thanks)
myutil._write("zhanbao.txt", 'a', thanks, "utf-8")
# 一轮战罢
# 时间有限编不下去了。。。while循环下

